package com.clkj.xiuzheng.dao;

import com.clkj.xiuzheng.pojo.OutStockItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
 * @author yawang
 * @create 2024/04/19 09:35:43
 **/
@Repository
public interface OutStockItemMapper extends Mapper<OutStockItem>, MySqlMapper<OutStockItem> {
    @Select("select a.*,b.product_img,b.product_name,b.format_name from t_cl_outStockItem a left join t_cl_product b " +
            "on a.product_id = b.product_id where a.out_id = #{outId} and a.item_flag=1")
    List<OutStockItem> outStockDetail(@Param("outId")Integer outId);

    @Select("select item_id,product_id,product_num,product_price from t_cl_outStockItem where product_id = #{productId}")
    OutStockItem selectByProductId(@Param("productId")  Integer productId);

    @Select("select a.*,b.product_name,b.format_name,c.warehouse_name from t_cl_outStockItem a " +
            "left join t_cl_product b on a.product_id = b.product_id " +
            "left join t_cl_warehouse c on a.warehouse_id = c.warehouse_id " +
            "   where a.out_id = #{outId} and item_flag = 1")
    List<OutStockItem> getOutStockItemById(@Param("outId") Integer outId);
}
